﻿using System;

namespace Yglu.BusinessLayer
{
	public class Period
	{
		#region Properties

		public String Title { get; set; }
		public DateTime DateFrom { get; set; }
		public DateTime DateTo { get; set; }

		#endregion

		#region Defaults

		public static Period Today()
		{
			Period p = new Period();

			p.DateFrom = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
			p.DateTo = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));

			return p;
		}

		public static Period Yesterday()
		{
			Period p = new Period();

			p.DateFrom = Convert.ToDateTime(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 00:00:00"));
			p.DateTo = Convert.ToDateTime(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59"));

			return p;
		}

		public static Period Last7Days()
		{
			Period p = new Period();

			p.DateFrom = Convert.ToDateTime(DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd 00:00:00"));
			p.DateTo = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));

			return p;
		}

		public static Period Last30Days()
		{
			Period p = new Period();

			p.DateFrom = Convert.ToDateTime(DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd 00:00:00"));
			p.DateTo = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));

			return p;
		}

		#endregion
	}
}